<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition  
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
	
	<div id="header">

		<table>
			<tr>
				<td id="td_logo" rowspan="2">
					<h:outputLink value="accueil.xhtml">
						<h:graphicImage value="resources/images/logo.png"/>
					</h:outputLink>
				</td>
				
				<h:form rendered="#{beanUtilisateur.isConnect == false}">
					<td id="td_connexion">
						<h:outputLabel value="#{msg['label.pseudonyme']}"></h:outputLabel>
						<h:inputText id="header_pseudo" value="#{beanUtilisateur.user.pseudo}" required="true" requiredMessage="#{msg['erreur.pseudo']}" validatorMessage="#{msg['erreur.pseudo_regex']}">
							<f:validateRegex pattern="[a-zA-Z]{3,20}"></f:validateRegex>
						</h:inputText>
						
						<h:outputLabel value="#{msg['label.mot_de_passe']}"></h:outputLabel>
						<h:inputSecret id="header_mot_de_passe" value="#{beanUtilisateur.user.password}" required="true" requiredMessage="#{msg['erreur.mot_de_passe']}" validatorMessage="#{msg['erreur.mot_de_passe_regex']}">
							<f:validateRegex pattern="[a-zA-Z]+[0-9]+"></f:validateRegex>
							<f:validateLength minimum="6" maximum="15"></f:validateLength>
						</h:inputSecret>
						
						<h:commandButton type="submit" value="#{msg['bouton.connexion']}" action="#{beanUtilisateur.connexion}"></h:commandButton>
					</td>
				</h:form>
				
				<h:panelGroup rendered="#{beanUtilisateur.isConnect == true}">
					<td id="td_deconnexion">
						<h:outputText id="msg_bienvenue" value="#{msg['connexion.bienvenue']}#{beanUtilisateur.userIdentifiant}" rendered="#{beanUtilisateur.isConnect == true}"></h:outputText>
						<h:form>
							<h:commandLink action="#{beanUtilisateur.deconnexion}"> 
								<h:outputText value="#{msg['deconnexion.label']}"></h:outputText>
							</h:commandLink>
						</h:form>
					</td>
				</h:panelGroup>
				
				
				<td id="td_inscription">
					<h:outputLink value="inscription.xhtml" rendered="#{beanUtilisateur.isConnect == false}">
						<h:outputText value="#{msg['lien.inscription']}"></h:outputText>
					</h:outputLink>
				</td>
			</tr>
			
			<tr>
				<td colspan="3">
					<h:message styleClass="erreur_header" for="header_pseudo"></h:message>
					<h:message styleClass="erreur_header" for="header_mot_de_passe"></h:message>
				</td>
			</tr>
			
			<tr>
				<td colspan="3">
					<h:form id="form_recherche">
						<h:inputText value="#{beanRecherche.pattern}">
							<f:validateLength minimum="3" maximum="100"></f:validateLength>
						</h:inputText>
						
						<h:commandButton type="submit" value="#{msg['bouton.recherche']}" action="#{beanRecherche.recherche}"></h:commandButton>
					</h:form>
				</td>
			</tr>
		</table>
	
		<ui:include src="menu.xhtml"></ui:include>
		
	</div>
	
</ui:composition>
